﻿using System;
using UnityEngine.UI;
using UnityEngine.EventSystems;

namespace UnityEngine.UI
{
    public class PressReleaseButton : Button, IPointerDownHandler, IPointerUpHandler
    {
        public Action onPointerDown;
        public Action onPointerUp;

        public override void OnPointerDown(PointerEventData eventData)
        {
            base.OnPointerDown(eventData);

            if (onPointerDown != null)
            {
                onPointerDown();
            }
        }

        public override void OnPointerUp(PointerEventData eventData)
        {
            base.OnPointerUp(eventData);

            if (onPointerUp != null)
            {
                onPointerUp();
            }
        }
    }
}